package red.internal.core.message;

/**
 * @author Jin Zheng
 * @since 2020-05-16
 */
public enum Code
{
	SUCCESS(0x0),
	ERROR(0x1),
	HANDSHAKE(0x2),
	REGISTRY(0x11),
	CACHE(0x12);

	private int value;

	Code(int value)
	{
		this.value = value;
	}

	public static Code valueOf(int code)
	{
		for (Code c : Code.values())
		{
			if (c.value == code)
				return c;
		}
		return null;
	}

	public int value()
	{
		return this.value;
	}

}
